<template>
  <div class="app-container">

    <el-tabs type="border-card">

      <el-form :inline="true" :model="pageInfo" class="demo-form-inline">
        <el-form-item label="开始时间">
          <el-col :span="11">
            <el-date-picker v-model="pageInfo.ks" type="date" placeholder="选择日期" style="width: 100%;" />
          </el-col>
          <el-col class="line" :span="2">至</el-col>
          <el-col :span="11">
            <el-date-picker v-model="pageInfo.js" type="date" placeholder="选择日期" style="width: 100%;" />
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="sousuo">查询</el-button>
        </el-form-item>
      </el-form>
      <!-- <table
      :data="tableData"
      stripe
      style="width: 100%">
        <el-table-column prop="" label="交易时间" width="180">
            <template v-slot="slot">
              {{slot.row.totals}}
            </template>
        </el-table-column>
      </table> -->

      <!-- {{this.tableData.totals}} -->
      <el-tab-pane label="收入明细">
        <h3>金额总计：{{ this.zj }}元</h3>
        押金(总计):{{ this.yj }}租金(总计):{{ this.zz }}电费(总计):{{ this.dj }}水费(总计):{{ this.sj }}宽带(总计):{{ this.kj }}燃气费(总计):{{ this.rj }}<br>
        有线电视(总计):{{ this.xj }}其他(总计):{{ this.qj }}
        <el-table
          :data="tableData"
          stripe
          style="width: 100%"
        >
          <el-table-column prop="dealDate" label="交易时间" width="180" />
          <el-table-column prop="total" label="总计(元)" width="180" />
          <el-table-column prop="deposit" label="押金(元)" width="180" />
          <el-table-column prop="rent" label="租金(元)" width="180" />
          <el-table-column prop="electricityFee" label="电费(元)" width="180" />
          <el-table-column prop="waterFee" label="水费(元)" width="180" />
          <el-table-column prop="netFee" label="宽带(元)" width="180" />
          <el-table-column prop="gasFee" label="燃气费(元)" width="180" />
          <el-table-column prop="cableFee" label="有线电视费(元)" width="180" />
          <el-table-column prop="otherFee" label="其他(元)" width="180" />
          <el-table-column prop="totals" label="其他(元)" width="180" />
          <el-table-column
            fixed="right"
            label=""
            width="100"
          >
            <template slot-scope="scope">
              <el-button type="text" size="small" @click="cx(scope.row)">1111</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          layout="prev, pager, next"
          :page-size="pageInfo.pageSize"
          :total="pageInfo.total"
          :page-count="pageInfo.pageCount"
          :current-page="pageInfo.currPage"
          @current-change="pageChange"
        />
      </el-tab-pane>
      <el-tab-pane label="支出明细">
        <h3>金额总计：{{ this.zjs }}元</h3>
        押金(总计):{{ this.yjs }}租金(总计):{{ this.zzs }}电费(总计):{{ this.djs }}水费(总计):{{ this.sjs }}宽带(总计):{{ this.kjs }}燃气费(总计):{{ this.rjs }}<br>
        有线电视(总计):{{ this.xjs }}其他(总计):{{ this.qjs }}
        <el-table
          :data="tableDatas"
          stripe
          style="width: 100%"
        >
          <el-table-column prop="dealDate" label="交易时间" width="180" />
          <el-table-column prop="total" label="总计(元)" width="180" />
          <el-table-column prop="deposit" label="押金(元)" width="180" />
          <el-table-column prop="rent" label="租金(元)" width="180" />
          <el-table-column prop="electricityFee" label="电费(元)" width="180" />
          <el-table-column prop="waterFee" label="水费(元)" width="180" />
          <el-table-column prop="netFee" label="宽带(元)" width="180" />
          <el-table-column prop="gasFee" label="燃气费(元)" width="180" />
          <el-table-column prop="cableFee" label="有线电视费(元)" width="180" />
          <el-table-column prop="otherFee" label="其他(元)" width="180" />
          <el-table-column
            fixed="right"
            label=""
            width="100"
          >
            <template slot-scope="scope">
              <el-button type="text" size="small" @click="cxs(scope.row)">1111</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          layout="prev, pager, next"
          :page-size="pageInfo.pageSize"
          :total="pageInfo.total"
          :page-count="pageInfo.pageCount"
          :current-page="pageInfo.currPage"
          @current-change="pageChange"
        />

      </el-tab-pane>
    </el-tabs>

  </div>
</template>
<script>
export default {
  data() {
    return {
      tableData: [{
        totals: ''
      }],
      tableDatas: [],
      zj: '',
      yj: '',
      zz: '',
      dj: '',
      sj: '',
      kj: '',
      rj: '',
      xj: '',
      qj: '',
      zjs: '',
      yjs: '',
      zzs: '',
      djs: '',
      sjs: '',
      kjs: '',
      rjs: '',
      xjs: '',
      qjs: '',
      pageInfo: {
        pageSize: 10,
        total: 1,
        pageCount: 10,
        pageNum: 1,
        mx: 1,
        startTime: '',
        endTime: '',
        ks: '',
        js: ''
      }
    }
  },
  created() {
    this.initlist()
    this.list()
    this.cx()
  },
  methods: {
    initlist() {
      this.pageInfo.startTime = this.pageInfo.ks
      this.pageInfo.endTime = this.pageInfo.js
      this.axios.get('http://localhost:80/api/cw/wish/t-cw-deal-per-day/getList', { params: this.pageInfo }).then(res => {
        this.tableData = res.data.records

        this.pageInfo.pageSize = res.data.size
        this.pageInfo.total = res.data.total
        this.pageInfo.pageCount = res.data.pages
        this.pageInfo.pageNum = res.data.current
      })
    },
    list() {
      this.pageInfo.startTime = this.pageInfo.ks
      this.pageInfo.endTime = this.pageInfo.js
      this.axios.get('http://localhost:80/api/cw/wish/t-cw-deal-per-day/getLists', { params: this.pageInfo }).then(res => {
        this.tableDatas = res.data.records

        this.pageInfo.pageSize = res.data.size
        this.pageInfo.total = res.data.total
        this.pageInfo.pageCount = res.data.pages
        this.pageInfo.pageNum = res.data.current
      })
    },
    pageChange(val) {
      this.pageInfo.pageNum = val
      this.initlist()
      this.list()
    },
    sousuo() {
      this.pageInfo.pageNum = 1
      this.initlist()
      this.list()
    },
    cx(rowData) {
      this.zj = rowData.totals
      this.yj = rowData.deposits
      this.zz = rowData.rents
      this.dj = rowData.electricityfees
      this.sj = rowData.waterfees
      this.kj = rowData.netfees
      this.rj = rowData.gasfees
      this.xj = rowData.cablefees
      this.qj = rowData.otherfees
      this.$alert(rowData.totals)
    },
    cxs(rowData) {
      this.zjs = rowData.totals
      this.yjs = rowData.deposits
      this.zzs = rowData.rents
      this.djs = rowData.electricityfees
      this.sjs = rowData.waterfees
      this.kjs = rowData.netfees
      this.rjs = rowData.gasfees
      this.xjs = rowData.cablefees
      this.qjs = rowData.otherfees
      this.$alert(rowData.totals)
    }
  }
}
</script>
